package simplefactory;

import simplefactory.fruits.Apple;
import simplefactory.fruits.Banana;
import simplefactory.fruits.abstracts.Fruits;
import simplefactory.fruits.Grape;

/**
 * @ClassName: SimpleFruitFactory
 * @Description: 水果简单工厂
 * @Date: 2021/1/12 14:39
 * @Author: Song JinGen
 */
public class SimpleFruitFactory {
    public Fruits createFruit(String type){
        Fruits fruits = null;
        if (type.equals("apple")){
            fruits = new Apple();
        }else if (type.equals("banana")){
            fruits = new Banana();
        }else if (type.equals("grape")){
            fruits = new Grape();
        }
        return fruits;
    }

}
